var http_request=false;
    function send_request(url){//初始化，指定处理函数，发送请求的函数
    http_request=false;
        //开始初始化XMLHttpRequest对象
        if(window.XMLHttpRequest){//Mozilla浏览器
         http_request=new XMLHttpRequest();
         if(http_request.overrideMimeType){//设置MIME类别
           http_request.overrideMimeType("text/xml");
         }
        }
        else if(window.ActiveXObject){//IE浏览器
         try{
          http_request=new ActiveXObject("Msxml2.XMLHttp");
         }catch(e){
          try{
          http_request=new ActiveXobject("Microsoft.XMLHttp");
          }catch(e){}
         }
    }
        if(!http_request){//异常，创建对象实例失败
         window.alert("创建XMLHttp对象失败！");
         return false;
        }
}
//处理返回信息的函数


var xmlHttp;
function S_xmlhttprequest() {
 if(window.ActiveXObject) {
  xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
 } else if(window.XMLHttpRequest) {
  xmlHttp = new XMLHttpRequest();
 }
}

function checkusername(f) {   
var GetRandomn = 1;   
//获取随机范围内数值的函数   
function GetRandom(n){GetRandomn=Math.floor(Math.random()*n+1)}   
//开始调用，获得一个1-100的随机数   
GetRandom("9999");   

 S_xmlhttprequest();
 
 xmlHttp.open("GET","include/cart.php?item="+f+"&"+GetRandomn,true);
 xmlHttp.onreadystatechange = checkingname;
 xmlHttp.send(null);
 
}


function ajax_admin_ch_item(f,t,s) {  
var f;
var t;
var s;
var value = document.getElementById(t+f).value;
//var q =confirm(t);
//if(q != 0){

var GetRandomn = 1;  

//alert('dfdf');
function GetRandom(n){GetRandomn=Math.floor(Math.random()*n+1)}      
GetRandom("9999");   

 S_xmlhttprequest();
 
 xmlHttp.open("GET","include/admin_item.php?ch_item="+f+"&a="+t+"&value="+value+"&sid="+s+"&"+GetRandomn,true);
 xmlHttp.onreadystatechange = ajax_show_to_id;
 xmlHttp.send(null);


//}
}

/////////


function ajax_ch(iid,limit,uid) {  
var iid;
var limit;
var uid;
var quantity = document.getElementById("item"+iid).value;
var e_q;
if (quantity >= limit){
	e_q = limit;
	}else{
		e_q = quantity;
		}

//var vv = document.getElementById("item"+f).value;
var GetRandomn = 1;  


function GetRandom(n){GetRandomn=Math.floor(Math.random()*n+1)}      
GetRandom("9999");   

 S_xmlhttprequest();
 
 xmlHttp.open("GET","include/cart.php?ch_order="+iid+"&quantity="+e_q+"&uid="+uid+"&"+GetRandomn,true);
 xmlHttp.onreadystatechange = ajax_show_to_id;
 xmlHttp.send(null);

	
}


///////////////////


function checkingname() {  if(xmlHttp.readyState == 1) {
   document.getElementById('show').innerHTML = "<img src='images/loading.gif'>";
 }   if(xmlHttp.readyState == 4 ){
  if(xmlHttp.status == 200) {
          var checkresult =  xmlHttp.responseText;
          document.getElementById('show').innerHTML = checkresult;
  }
 }
}

function ajax_show_to_id() {  if(xmlHttp.readyState == 1) {
   document.getElementById('show_ch').innerHTML = "<img src='images/loading.gif'>";
 }   if(xmlHttp.readyState == 4 ){
  if(xmlHttp.status == 200) {
          var checkresult =  xmlHttp.responseText;
          document.getElementById('show_ch').innerHTML = checkresult;
  }
 }
}

